<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        body {
            height: 2000px;
        }
        
        #outer {
            width: 300px;
            height: 300px;
            background: red;
        }
        
        #inner {
            width: 200px;
            height: 200px;
            background: yellowgreen;
        }
        
        #top {
            width: 50px;
            height: 50px;
            position: fixed;
            right: 0;
            bottom: 0;
            background: red;
        }
    </style>
</head>

<body>
    <div id="outer">
        <div id="inner"></div>
    </div>

    <div id="top">返回顶部</div>
    <script>
        outer.onclick = function(e) {
            if (e.target.id == "inner") {
                alert("inner")
            }
        }

        let x = prompt("请输入你的年龄");
        console.log(x)
    </script>
</body>

</html>